import request from '@/utils/request'
import {param} from "@/utils";

// 查询已绑定的用户
export function listBindStaff(query) {
  return request({
    url: '/basic/staff/listBindStaff',
    method: 'get',
    params: query
  })
}

// 查询人员信息列表
export function listStaff(query) {
  return request({
    url: '/basic/staff/list',
    method: 'get',
    params: query
  })
}

// 查询人员信息详细
export function getStaff(staffId) {
  return request({
    url: '/basic/staff/' + staffId,
    method: 'get'
  })
}

// 新增人员信息
export function addStaff(data) {
  return request({
    url: '/basic/staff',
    method: 'post',
    data: data
  })
}

// 修改人员信息
export function updateStaff(data) {
  return request({
    url: '/basic/staff',
    method: 'put',
    data: data
  })
}

// 删除人员信息
export function delStaff(staffId) {
  return request({
    url: '/basic/staff/' + staffId,
    method: 'delete'
  })
}

// 获取工程师列表
export function optionEngineer(param) {
  return request({
    url: '/basic/staff/optionEngineer',
    method: 'get',
    params: param
  })
}

// 解绑人员信息社交账号
export function unbindSocialInfo(oauthId) {
  return request({
    url: '/basic/staff/unbindSocial/' + oauthId,
    method: 'delete'
  })
}

// 根据医院ID和岗位code查询员工列表
export function optionStaff(hospitalId, postCode) {
  return request({
    url: '/basic/staff/option',
    method: 'get',
    params: {
      hospitalId,
      postCode
    }
  })
}

export function optionStaffByCompany(companyId, roleKey) {
  return request({
    url: 'basic/staff/optionByCompany',
    method: 'get',
    params: {
      companyId,
      roleKey
    }
  })
}

//工作人员重置密码
export function resetCompanyStaffPwd(userId, password) {
  const data = {
    userId,
    password
  }
  return request({
    url: '/basic/staff/resetPwd',
    method: 'put',
    data: data
  })
}

// 工作人员启用登录
export function changeStatus(userId, status) {
  const data = {
    userId,
    status
  }
  return request({
    url: '/basic/staff/changeStatus',
    method: 'put',
    data: data
  })
}
